
<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="购票系统">
    <meta name="author" content="">
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">

    <title>购票系统</title>

    <!-- Bootstrap core CSS -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <link href="assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <script src="assets/js/ie-emulation-modes-warning.js"></script>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
      <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- Custom styles for this template -->
    <link href="assets/css/carousel.css" rel="stylesheet">
    <link href="assets/css/common.css" rel="stylesheet">
    <style type="text/css">
      body{
      	padding-top:70px;
      }
	  table{
	  	border-bottom: 1px solid #ddd;
	  }
    </style>
  </head>
  <!-- NAVBAR -->
  <body>
    <div id="app">
    <nav class="navbar navbar-default navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="index.html">购票系统</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
          <ul class="nav navbar-nav navbar-right hidden-sm">
          </ul>
        </div>
      </div>
    </nav>

    <!-- Wrap the rest of the page in another container to center all the content. -->
    <div class="container marketing">
      <!-- Three categorys of text below the carousel-->
      <div class="row">
      	<div class="col-md-12">
	        <table class="table">
  				<thead>
  					<tr>
  						<th>出发地</th>
  						<th>目的地</th>
  						<th>价格</th>
  						<th style="width: 100px">操作</th>
  					</tr>
  				</thead>
  				<tbody>
  					<tr v-for="ticket in tickets">
  						<td>{{ticket.departure}}</td>
  						<td>{{ticket.destination}}</td>
  						<td>{{ticket.price}}</td>
  						<td> <button type="button" class="btn btn-primary btn-xs" @click="buy(ticket.id)">立即购买</button></td>
  					</tr>
  				</tbody>
  			</table>
	    </div>
      </div><!-- /.row -->
    </div>

    <!-- FOOTER -->
    <footer style="text-align: center">
      <p></p>
    </footer>

  </div>

  <!-- Bootstrap core JavaScript
  ================================================== -->
  <!-- Placed at the end of the document so the pages load faster -->
  <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
  <script>window.jQuery || document.write('<script src="assets/js/vendor/jquery.min.js"><\/script>')</script>
  <script src="https://cdn.bootcss.com/vue/2.6.8/vue.min.js"></script>
  <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <!-- Just to make our placeholder images work. Don't actually copy the next line! -->
  <script src="assets/js/vendor/holder.min.js"></script>
  <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
  <script src="assets/js/ie10-viewport-bug-workaround.js"></script>
  <script src="assets/js/common.js"></script>
	<script>
	var app = new Vue({
	  el: '#app',
	  data: {
		  tickets: [],
          user: null
	  },
      methods: {
        getCategory: function(){
          $.getJSON(domain + "/api/ticket/list", {}, function(r){
            if(r.code == 0){
              app.tickets = r.ticketList;
            }
          })
        },

        buy: function(id){
          location.href="order-confirm.html?id="+id;
        },
        selectCategory: function(categoryId){
        	this.getGoods(categoryId);
        },
        logout: function(){
            localStorage.removeItem("fuser");
            app.user = null;
          }
        
      },
      created: function(){
    	var storeId = T.p("storeId");
        this.getCategory();
        var user = localStorage.getItem("fuser");
        if(user){
          this.user = JSON.parse(user);
        }
      }
	})
	</script>
  </body>
</html>
